﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2012-12-12
Description:Agency_Photo三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
namespace FTchina.DAL
{
	public static partial class Agency_PhotoService
	{
		 
	 
			
		public static int DeleteAgency_PhotoById(long id)	
		{     
            Agency_Photo agency_Photo = new Agency_Photo();
            agency_Photo.Id = id;
            EntityQuery<Agency_Photo> query = new EntityQuery<Agency_Photo>(agency_Photo);
             return query.Delete(agency_Photo);
		}	
        
          //以标识列获得对象
        public static Agency_Photo GetAgency_PhotoById(long  id)
        {
            Agency_Photo agency_Photo = new Agency_Photo();
            agency_Photo.Id = id;
            EntityQuery<Agency_Photo> query = new EntityQuery<Agency_Photo>(agency_Photo);
            query.FillEntity(agency_Photo);
            return agency_Photo;
        }
		
	 
	 
       
        
        
        
		 
		 
		 public static int AddOrUpdateAgency_Photo(Agency_Photo agency_Photo)
        {
            Agency_Photo _agency_Photo = new Agency_Photo();

            EntityQuery<Agency_Photo> query = new EntityQuery<Agency_Photo>(_agency_Photo);
           _agency_Photo= agency_Photo;
           int i=(agency_Photo.Id==0)?
                 query.Insert(_agency_Photo): query.Update(_agency_Photo);
            return i;
        }
		
		 
	}
}

